<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8" import="pojo.*,service.*,java.util.*,java.text.*"%>

<%
request.setCharacterEncoding("UTF-8");

int id = (Integer)session.getAttribute("id");
String name = (String)session.getAttribute("name");

String oldpw=request.getParameter("opw");

String newpw1=request.getParameter("npw1");

String newpw2=request.getParameter("npw2");


	
	ManagerService stu2=new ManagerService();
	
	
	String oldpw1=stu2.managerLogin(name,oldpw).getPassword();
	
	if(oldpw1.equals(oldpw) && newpw1.equals(newpw2)){
		
		
		int update1=stu2.updatePassword(newpw1,id);
		
		out.print("修改成功！");
		response.sendRedirect("../index.jsp");
		
	}else{
		
		out.print("修改失败！");
		response.sendRedirect("../updatepassword.jsp");
		
	}



%>

